//
//  CusTableViewCell.m
//  26-Masonry
//
//  Created by dllo on 16/8/18.
//  Copyright © 2016年 ZHW. All rights reserved.
//

#import "CusTableViewCell.h"
#import "Masonry.h"
@interface CusTableViewCell ()
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UIImageView *phoImageView;
@end

@implementation CusTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _nameLabel.backgroundColor = [UIColor redColor];
        _nameLabel.text = @"name";
        [self.contentView addSubview:_nameLabel];
        
        self.descLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _descLabel.text = @"desc";
        _descLabel.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:_descLabel];
        
        self.phoImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        _phoImageView.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_phoImageView];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.bottom.mas_equalTo(0);
        make.top.mas_equalTo(0);
    }];
    
    [_descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_nameLabel.mas_right).offset(10);
        make.top.mas_equalTo(_nameLabel);
        make.bottom.mas_equalTo(_nameLabel);
    }];
    
    [_phoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_descLabel.mas_right).offset(10);
        make.width.mas_equalTo(self.contentView).multipliedBy(0.5f);
        make.top.mas_equalTo(10);
        make.bottom.mas_equalTo(-10);
        
    }];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
